/**
 * 
 */
package com.lion.jacoco.dao.dataobject;

import java.io.File;
import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.lion.jacoco.common.JacocoConstant;

/**
 * AppConfigDO.java. 2011-11-26下午9:25:06 @author LionBule.
 */
public class AppConfigDO implements Serializable {
    private static final long serialVersionUID = 7427277068500457330L;

    private int               id;
    private String            appName;
    private String            ip;
    private Date              gmtCreate;
    private Date              gmtModified;

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    /**
     * 定义report输出路径.
     * 
     * @return
     */
    public String getReportPath(String baseDir) {
        if (StringUtils.isBlank(baseDir)) {
            throw new IllegalArgumentException();
        }
        return new StringBuilder().append(baseDir).append(File.separatorChar).append(this.appName)
                .append("_").append(this.id).append(File.separatorChar).toString();
    }

    public String getCodePath(String codePath) {
        return new StringBuilder().append(codePath).append(File.separatorChar).append(this.appName)
                .append("_").append(this.id).append(File.separatorChar).toString();
    }

    public String getExecFile(String codePath) {
        return new StringBuilder().append(codePath).append(File.separatorChar).append(this.appName)
                .append("_").append(this.id).append(File.separatorChar)
                .append(JacocoConstant.JACOCO_FILENAME).toString();
    }

    public String getBaseName() {
        return appName + "_" + id;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

}
